package at.fhj.itm11.forum.api;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.inject.Named;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import at.fhj.itm11.forum.service.UserService;
import at.fhj.itm11.forum.service.dtos.UserDTO;

@Stateless
@Remote(UserService.class)
public class UserServiceApi implements UserService {

	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Inject
	@Named("userServiceImpl")
	private UserService service;
	
	@Override
	public UserDTO findById(Long id) {
		logger.info("findById called from public API with " + id);
		return service.findById(id);
	}

	@Override
	public UserDTO findByUsername(String username) {
		logger.info("findByUsername called from public API with " + username);
		return service.findByUsername(username);
	}

	@Override
	public UserDTO login(String username, String password) {
		logger.info("login called from public API with " + username + " "
				+ password);
		return service.login(username, password);
	}

}
